﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" CodeBehind="DonorManagement.aspx.cs" Inherits="UNDP_Projects.CO.DonorManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableDelete="True" EnableFlattening="False" EnableInsert="True" 
        EnableUpdate="True" EntitySetName="donors">
    </asp:EntityDataSource>

    <div style="height:2em;">
        <div style="float:left;">
            <asp:Label ID="ContextLabel" runat="server" Text="DONORS" CssClass="ContentHead"></asp:Label>
        </div>
        <% if (User.IsInRole("Administrator"))
           { %>
        <div style="float:right;">
            <asp:Button ID="AddDonorButton" runat="server" Text="Add Donor" OnClick="AddDonorButton_Click" />
        </div>
        <% } %>
    </div>

    <% if (User.IsInRole("Administrator"))
       { %>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="EntityDataSource1" DataKeyNames="donor_id" CssClass="NewGrid" 
            ShowFooter="true">
            <AlternatingRowStyle CssClass="NewGridAlt" />
            <Columns>
                <asp:TemplateField HeaderText="DONORS">
                    <EditItemTemplate>
                        <asp:TextBox ID="DonorTX" runat="server" Width="40em" Text='<%# Bind("donor1") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" CssClass="MText" Text='<%# Bind("donor1") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Left" Width="60em" />
                </asp:TemplateField>

                <asp:CommandField ShowEditButton="true" ButtonType="Button" HeaderText="EDIT" />
                <asp:CommandField ShowDeleteButton="true" ButtonType="Button" HeaderText="DELETE" />

            </Columns>
            <FooterStyle CssClass="NewGridFooter" />
        </asp:GridView>
    <% }
       else
       { %>
       <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataSourceID="EntityDataSource1" DataKeyNames="donor_id" CssClass="NewGrid" 
        ShowFooter="true">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:TemplateField HeaderText="DONORS">
                <EditItemTemplate>
                    <asp:TextBox ID="DonorTX" runat="server" Width="40em" Text='<%# Bind("donor1") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" CssClass="MText" Text='<%# Bind("donor1") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Left" Width="60em" />
            </asp:TemplateField>
        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% } %>

</asp:Content>
